package com.ruihui.activity.service.impl;

import java.math.BigDecimal;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.github.pagehelper.PageInfo;
import com.ruihui.activity.mapper.AcgrecordMapper;
import com.ruihui.activity.pojo.Acgrecord;
import com.ruihui.activity.service.AcgrecordService;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author cf123
 * @since 2018-09-30
 */
@Service
public class AcgrecordServiceImpl extends ServiceImpl<AcgrecordMapper, Acgrecord> implements AcgrecordService {
	@Autowired
	private AcgrecordMapper acgrecordMapper;
	public PageInfo<Acgrecord> getRecords(Long memberId, Long acgid, Long goodsId, BigDecimal starttime, BigDecimal endtime) {
		List<Acgrecord> list=acgrecordMapper.selectList(new EntityWrapper<Acgrecord>().eq(!StringUtils.isEmpty(memberId),"userid", memberId)
				.eq("state", 1)
				.eq(!StringUtils.isEmpty(acgid),"acid", acgid).eq(!StringUtils.isEmpty(goodsId),"goodsid", goodsId).between(!StringUtils.isEmpty(starttime) && !StringUtils.isEmpty(endtime),"createtime", starttime, endtime));
		return new PageInfo<Acgrecord>(list);
	}

}
